package com.ruoyi.web.controller.system;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.system.domain.dto.ShoppingCarDto;
import com.ruoyi.system.service.IAOrdersService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("/system/shopping")
public class AShoppingController extends BaseController {
    private String prefix = "system/shopping";
    @Autowired
    private IAOrdersService ordersService;

    @GetMapping()
    public String orders() {
        return prefix + "/shopping";
    }

    @PostMapping("/create")
    public Integer createOrders(@RequestBody ShoppingCarDto shoppingCarDto) {
        Integer i = ordersService.saveOrdersAndDetails(shoppingCarDto);
        return i;
    }
}
